<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /*  让网格垂直水平居中
        justify-content 设置整个网格在容器中水平方向
        align-content    设置整个网格在容器中垂直方向*/
        .parent{
            height: 400px;
            background-color: red;
            display:grid;
            grid-template-columns: 100px 100px 100px;
            grid-template-rows: repeat(2,100px);
            grid-gap:20px 10px;
            justify-content: center;
            align-content: center;
        }
        .item{
            border: 1px solid #333;
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="item">

        </div>
        <div class="item">
            
        </div>
        <div class="item">
            
        </div>
        <div class="item">
            
        </div>
        <div class="item">
            
        </div>
        <div class="item">
            
        </div>
    </div>
</body>
</html>